package com.bite.job.manager;

import com.bit.common.redis.service.RedisService;
import com.bite.common.core.constants.CacheConstants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Set;

@Component
public class ExamCacheManager {
    @Autowired
    private RedisService redisService;


    // 批量删除竞赛Rank列表
    public void deleteRankList(Set<Long> examIdSet) {
        List<String> examKeySet = examIdSet.stream().map(this::getRankListKey).toList();
        redisService.deleteMultiObject(examKeySet);
    }

    private String getRankListKey(Long examId) {
        return CacheConstants.EXAM_RANK_LIST + examId;
    }
}
